@tailwind base;
@tailwind components;
@tailwind utilities;

/* 自定义响应式工具类 */
@layer components {
  .responsive-container {
    @apply container mx-auto px-4 sm:px-6 lg:px-8;
  }
  
  .mobile-only {
    @apply block sm:hidden;
  }
  
  .desktop-only {
    @apply hidden sm:block;
  }
}

:root {
  --bg-color: #f5f5f5;
  --text-color: #333;
  --card-bg: #fff;
  --border-color: #eee;
}

[data-theme='dark'] {
  --bg-color: #1a1a1a;
  --text-color: #fff;
  --card-bg: #242424;
  --border-color: #333;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-color);
  min-height: 100vh;
  color: var(--text-color);
  transition: all 0.3s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #1677ff;
  color: white;
  cursor: pointer;
  margin: 5px;
}

button:hover {
  background-color: #4096ff;
}

.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #1677ff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.nav-container {
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 20px;
  font-weight: bold;
  color: #1677ff;
  text-decoration: none;
}

.nav-menu {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-link {
  text-decoration: none;
  color: var(--text-color);
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: #1677ff;
  background: rgba(22, 119, 255, 0.1);
}

.nav-link.active {
  color: #1677ff;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: #1677ff;
  border-radius: 2px;
}

.input-wrapper {
  margin: 20px 0;
}

.custom-input {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--card-bg);
  color: var(--text-color);
  font-size: 16px;
  transition: all 0.3s ease;
}

.custom-input:focus {
  outline: none;
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

.input-display {
  margin-top: 10px;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* 让输入框内的文本可选中 */
.custom-input {
  user-select: text;
}

.products-header {
  margin-bottom: 40px;
}

.products-header h1 {
  margin-bottom: 20px;
  color: var(--text-color);
}

.product-form {
  background-color: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.input-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.input-group .custom-input {
  flex: 1;
  min-width: 200px;
}

.add-btn {
  background-color: #52c41a;
  min-width: 120px;
}

.add-btn:hover {
  background-color: #73d13d;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.product-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-info h3 {
  margin-bottom: 8px;
  color: var(--text-color);
}

.price {
  color: #f5222d;
  font-size: 18px;
  font-weight: bold;
}

.delete-btn {
  background-color: #ff4d4f;
  padding: 6px 12px;
}

.delete-btn:hover {
  background-color: #ff7875;
}

/* 输入框内的文字可选 */
.custom-input {
  user-select: text;
}

.products-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.select-all input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.batch-delete-btn {
  background-color: #ff4d4f;
  border: none;
  color: white;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.batch-delete-btn:hover {
  background-color: #ff7875;
}

.product-card {
  position: relative;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.product-card.selected {
  border-color: #1677ff;
}

.product-card-header {
  position: absolute;
  top: 10px;
  left: 10px;
}

.product-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* 调整产品信息的位置，为复选框留出空间 */
.product-info {
  padding-left: 25px;
}
